package Demo.demo3;

public class Main1 {
    public static void main(String[] args) {
        Animal animal =new Cat();
       // animal.eat();
        giveMeMeAPet(new Cat());
    }


    public static void giveMeMeAPet(Animal animal){
        if (animal instanceof Dog){
            Dog dog =(Dog)animal;
            dog.play();
        }
        if (animal instanceof Cat){
            Cat cat = (Cat) animal;
            cat.play();
        }
    }
}
